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

Query time 0.00028