UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'XeRVdBykottfhhL1Vmkl/iB0B5G9RGxTRqBNha5FUFc=' 
WHERE 
  key_id = 'd03b8f911842a705e2603f83278e8abf38e3b20555272512c949d9a6379a8320' 
  AND (
    token = 'XeRVdBykottfhhL1Vmkl/iB0B5G9RGxTRqBNha5FUFc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034