UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'dt/cW0h8aX8MT2arimxlHLR6NHiiwVh0tdmaPUMu78M=' 
WHERE 
  key_id = 'b6ddeb054edbee96aa0935f145fa40095def8b69bee4f56552039b6cd35adcc1' 
  AND (
    token = 'dt/cW0h8aX8MT2arimxlHLR6NHiiwVh0tdmaPUMu78M=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022