UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'spGksOrBoSfZ9AkMb4YI3lrhLFXESUWsCoVYtTzGMtw=' 
WHERE 
  key_id = '217e881c8a92564a84552a3d84d3dcfacf792086110c1533cc5c644f3bcf70ba' 
  AND (
    token = 'spGksOrBoSfZ9AkMb4YI3lrhLFXESUWsCoVYtTzGMtw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024