UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'WtNh7DY4lE/G3f/Xx7uLxfjdR/+GEuGkx52IWL/W5j8=' 
WHERE 
  key_id = 'b3f1f549779453040a2e8f0e0860378bc58aa9e81406c73276183ea4a9ffed8d' 
  AND (
    token = 'WtNh7DY4lE/G3f/Xx7uLxfjdR/+GEuGkx52IWL/W5j8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00021