UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'KahUYQfotmPd03P5ztZbUrM8S5u22CiYjUDb2b2t6LY=' 
WHERE 
  key_id = '16cd33379c67f81338fcf5ace3e8ebeae59a91107efe503a99fb21a1930455e5' 
  AND (
    token = 'KahUYQfotmPd03P5ztZbUrM8S5u22CiYjUDb2b2t6LY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029