UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'M0A1hVQTTIjZtsMk+yJ1c8avTOiNXyN3aaocUk2Kg8g=' 
WHERE 
  key_id = '61b15c252c182d4d2db0cc6374d3d6b8076178b859e24f8da3d6e73cf66fab6b' 
  AND (
    token = 'M0A1hVQTTIjZtsMk+yJ1c8avTOiNXyN3aaocUk2Kg8g=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00056