UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'V0nfD4twmAUYQfA0RvtFOY882Ugv5BwXehxrybcsu9M=' 
WHERE 
  key_id = '5836e3eb1694c95b511a848e4f63b0a91607e5947c90c9bd208873349c2826d0' 
  AND (
    token = 'V0nfD4twmAUYQfA0RvtFOY882Ugv5BwXehxrybcsu9M=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00020