UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'UTdYWbcJTZKoowfQpQJMnlzso+vwAMgQklPz2Xl14M0=' 
WHERE 
  key_id = '7a37a329fe09738b8aea24a416a6df8720a786444b36b0340fe79c458b464c8d' 
  AND (
    token = 'UTdYWbcJTZKoowfQpQJMnlzso+vwAMgQklPz2Xl14M0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028