UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '7HKI5LkkLdYjz1TgKWsmgQ8NBkVimeyK2sTQKYNom5Q=' 
WHERE 
  key_id = 'd586a034bc3a9c0d696e5d6d4a63f0c5dc637f7993347ec7e3f0107a86dda65e' 
  AND (
    token = '7HKI5LkkLdYjz1TgKWsmgQ8NBkVimeyK2sTQKYNom5Q=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00017