UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'UVpToF053Tnwy/xCd4Q0vGbXk6E6zYxL+GQ3scgR6Ak=' 
WHERE 
  key_id = '9c01e03e4db2e92e4a55aae674e0acda6d510df60e7a35a179dd82df260636f5' 
  AND (
    token = 'UVpToF053Tnwy/xCd4Q0vGbXk6E6zYxL+GQ3scgR6Ak=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042