UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ZnZRG41VX8TeaJTNnKojtVN0Pr6gka0BuCDyvZHSm40=' 
WHERE 
  key_id = 'b8112e5ee3b03f4c36e827c6f227fd5e821c0491106269e0f49359a3d27531f5' 
  AND (
    token = 'ZnZRG41VX8TeaJTNnKojtVN0Pr6gka0BuCDyvZHSm40=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030