UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'u0NzfWM5gaoXaApz74GEjltkuhrJeL5xayCB7IWhcSM=' 
WHERE 
  key_id = '16e8c30f2f66509dc228d4457a10b3873cf3bd3354ed9ffd72dd355d64c0d85b' 
  AND (
    token = 'u0NzfWM5gaoXaApz74GEjltkuhrJeL5xayCB7IWhcSM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00047