UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'VjC2OrKdMcel18EnCfLxG29tnmiPH134zYidrPTwPtc=' 
WHERE 
  key_id = '50a67d4d752b385516290c6435bc62c9ea4620401f95fbef5fc8dadf431f8b95' 
  AND (
    token = 'VjC2OrKdMcel18EnCfLxG29tnmiPH134zYidrPTwPtc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040