UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'F3kJ6pqeT3VMkr9PzN69Iqm2smFLptxm9jE7Wh/fpzQ=' 
WHERE 
  key_id = '239ce515feafe0e89b8164033c2b1650ae71455b87790fa14511696220ae80ea' 
  AND (
    token = 'F3kJ6pqeT3VMkr9PzN69Iqm2smFLptxm9jE7Wh/fpzQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036