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

Query time 0.00029