UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ldvEzGBdVP24WXzCHUSOtEM9nN+P9Gcg8DEq+E7ey0M=' 
WHERE 
  key_id = 'a53298c2c66cbf417d757e9d9264a16abec9d974ec820540cee093058265e348' 
  AND (
    token = 'ldvEzGBdVP24WXzCHUSOtEM9nN+P9Gcg8DEq+E7ey0M=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027