UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'WdSjmMD0GcVBtVtV4btVuJ34SKPpB8bOFwISU2STJ7Q=' 
WHERE 
  key_id = '68a94e9579520001a75212b783084b9cda5701b8830b02319d0b2959e483603a' 
  AND (
    token = 'WdSjmMD0GcVBtVtV4btVuJ34SKPpB8bOFwISU2STJ7Q=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043