UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Q3KgxqScjO4LBzJQyT5lYs6xIgRGBON3XhJb1TbKH8Y=' 
WHERE 
  key_id = '7facfaa5ea41668d92f745f551e4457ded6873ddc8f7bb8517baad0495d56df8' 
  AND (
    token = 'Q3KgxqScjO4LBzJQyT5lYs6xIgRGBON3XhJb1TbKH8Y=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044