UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'hyckUQB05l3uaPGvX+rlIWW2zZBYulGoYQrETrZT6SU=' 
WHERE 
  key_id = '8deabff0f86ee1f92b42f61fec0568660768275b4d95d3c92ef1f06648d5ef75' 
  AND (
    token = 'hyckUQB05l3uaPGvX+rlIWW2zZBYulGoYQrETrZT6SU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026