UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'RftRazClRNafwokyrcYJmKlS+ZLBc8AjoMAEtLeh6e4=' 
WHERE 
  key_id = 'f081d4bbb87f8b9e7149803ba28649c69b97014fd6f756533d4c284469d799b9' 
  AND (
    token = 'RftRazClRNafwokyrcYJmKlS+ZLBc8AjoMAEtLeh6e4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042