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

Query time 0.00030