UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'TnNo9hjrA0rsXqQ5ZTmzmjF4aRiEYJg7yo9Xf9h8pjQ=' 
WHERE 
  key_id = 'd54993531429733f54523e0c1ee944210f3de11ea5f766af0b40bea7ffeeddb7' 
  AND (
    token = 'TnNo9hjrA0rsXqQ5ZTmzmjF4aRiEYJg7yo9Xf9h8pjQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036