UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ePI7C3ocpoflGYvbV1qHGhywyo6JEZ+8+uuEk7lYJR8=' 
WHERE 
  key_id = '7af2a7d20ed8c319042cee696ed397ad8e38f9c851e50d1d85b496995ddee7ed' 
  AND (
    token = 'ePI7C3ocpoflGYvbV1qHGhywyo6JEZ+8+uuEk7lYJR8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038