UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'jWyHhK4dxpgTfNJk/hN8bFlMvPOvM6G/pu9KakIjV+U=' 
WHERE 
  key_id = '85b1485338e8bb50421c183d843b3f85d9821ef2d6e8647a26179904d7c79b44' 
  AND (
    token = 'jWyHhK4dxpgTfNJk/hN8bFlMvPOvM6G/pu9KakIjV+U=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042