UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Wzb307F6G2XqX4b8XmJkiUMBX4ekSz01FmacyEMnl5M=' 
WHERE 
  key_id = 'b9af9ce6667a3b8f39133df2faf996ee990f036d1d37527c9f5d9feb9309683b' 
  AND (
    token = 'Wzb307F6G2XqX4b8XmJkiUMBX4ekSz01FmacyEMnl5M=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029