UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'qYIm8kA/CsmaUuW2lBmgFNNMFDqUIStXWFmA9M+cUlU=' 
WHERE 
  key_id = '76cadaacfb0570da23861c3dd3c64cd39f7d684f840fae849fc443f3a91ff396' 
  AND (
    token = 'qYIm8kA/CsmaUuW2lBmgFNNMFDqUIStXWFmA9M+cUlU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00016