UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'XDSybwuTmPKef2MmI5UtqlmVKrU+1C4fNZ57tDz+ozU=' 
WHERE 
  key_id = '5d81312b2c5e8c067952146294a48c1b9b130006784c20634d943a1eccf17526' 
  AND (
    token = 'XDSybwuTmPKef2MmI5UtqlmVKrU+1C4fNZ57tDz+ozU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031