UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'LyQJy1vC+aUujb8ruRHSXUSHiLiqpVpAIp9wRaYkA/s=' 
WHERE 
  key_id = '834b34b74120f59b5aceee230011654998b527256fe8f96e765e8b830125f0f0' 
  AND (
    token = 'LyQJy1vC+aUujb8ruRHSXUSHiLiqpVpAIp9wRaYkA/s=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034