UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'd4f1KVUtJBiu6q+CoUSDaIyVVnqGoT9qBKtZlPFmHwc=' 
WHERE 
  key_id = 'f6100496fe475c3cb8fa99c1516638edf677885bf08bfb6557dd5a97ab1b44e0' 
  AND (
    token = 'd4f1KVUtJBiu6q+CoUSDaIyVVnqGoT9qBKtZlPFmHwc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030