UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'GT6kgMem2MdWp5traOs2rEggXCrpMCv14o3HDFSKr/8=' 
WHERE 
  key_id = '49fbd66a34af2865e90567463757db78ab08e1faa0beb79b2f858244e545b2b7' 
  AND (
    token = 'GT6kgMem2MdWp5traOs2rEggXCrpMCv14o3HDFSKr/8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00050