UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'B1Dt9Mma02ob6d1jrZWVBT2S5Z4YJ0+BQXDHjB3sP6w=' 
WHERE 
  key_id = '78768abea87bea7ca04716a7667b04e9fe612e134742a837bc326d4881f67b65' 
  AND (
    token = 'B1Dt9Mma02ob6d1jrZWVBT2S5Z4YJ0+BQXDHjB3sP6w=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025