UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '0+KZdDDbRxoQTBKVgsUn+l/hubPEbGO5J8s/PRoH2dI=' 
WHERE 
  key_id = '55e8202454e7c50af3e73a010cc502199f6dbd791a7a09e4cb4815ddd93f2322' 
  AND (
    token = '0+KZdDDbRxoQTBKVgsUn+l/hubPEbGO5J8s/PRoH2dI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00051