UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'bwqyTsDHtkrY9+5jzhWTlxRQ9DoqzmBKrmXGGzcq1ZM=' 
WHERE 
  key_id = '4339e48fe1054c36f8aa49f76ec225397a65f3501a64f68d0ae1a5339fd6fbad' 
  AND (
    token = 'bwqyTsDHtkrY9+5jzhWTlxRQ9DoqzmBKrmXGGzcq1ZM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030