UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'vn4sFS+1nlC9P5WavZs7WFrZJBhDK5rA40E3g3Pgc2M=' 
WHERE 
  key_id = '0d12e2066aba5bec624f3cf8862a9041d4649cd3c03e8e663c7550aeae4054dd' 
  AND (
    token = 'vn4sFS+1nlC9P5WavZs7WFrZJBhDK5rA40E3g3Pgc2M=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00021