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

Query time 0.00025