UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'm3Xc6HTZIYKuQ55GrD/4Sc34pjEGY3WiKaI+uGd5Or4=' 
WHERE 
  key_id = 'a1f50ed2ff1871158d179e94b3bdd283128e50cfd5f4e3664d6b7137e239d670' 
  AND (
    token = 'm3Xc6HTZIYKuQ55GrD/4Sc34pjEGY3WiKaI+uGd5Or4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030